package com.andreanaya.events
{
	import flash.events.Event;

	public class DataLibEvent extends Event
	{
		/**
		 * The <code>DataLibEvent.COMPLETE</code> constant defines the value of the type property of a complete dataLibEvent object.
		 */
		public static const COMPLETE:String = "onComplete";
		/**
		 * The <code>DataLibEvent.PROGRESS</code> constant defines the value of the type property of a progress dataLibEvent object.
		 */
		public static const PROGRESS:String = "onProgress";
		/**
		 * The <code>DataLibEvent.ERROR</code> constant defines the value of the type property of a error dataLibEvent object.
		 */
		public static const ERROR:String = "onError";
		
		/**
		 * The number of items or bytes loaded when the listener processes the event. 
		 */
		public var bytesLoaded:Number;
		/**
		 * The total number of items or bytes that will be loaded if the loading process succeeds.
		 */
		public var bytesTotal:Number;
		/**
		 * The percentage of the loading process. This value floats from 0 to 1.
		 */
		public var percent:Number;
		/**
		 * The data returned when the loading process is complete.
		 */
		public var data:*;
		/**
		 * The object returned when the loading process is complete.
		 */
		public var returnObject:Object;
		/**
		 * The id of the loaded file.
		 */
		public var id:String;
		
		/** 
		 * Creates a new DataLibEvent instance.
		 */
		public function DataLibEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, param:Object = null)
		{
			super(type, bubbles, cancelable);
			
			if(param)
			{
				var i:String;
				
				for(i in param)
				{
					this[i] = param[i];
				}
			}
		}
		
	}
}